<template>
    <div id="building">
        <!-- <img src="../assets/veer-300207069.jpg" width="1000px" height="1500px"> -->
        <br>
        <br>
        <br>


            <h3>hello</h3><br><br><br>
            用户名<el-input type="text" v-model="username" style="width:180px"/> <br><br><br><br>
            密&emsp;码<el-input type="password"  v-model="password" style="width:180px"/> <br><br><br>
            <el-button @click="res" type="info">注册</el-button>
            <div><br></div>
            <div>
            <el-button @click="golog" type="info">已有账号?直接去登录!</el-button>
        </div>
        
        
        
    </div>
</template>

<script>
export default {
    name: 'register',
    data() {
        return {
            username:'',
            password:'',
        };
    },
    props: {},

    components: {},

    created() {},

    mounted() {},

    methods: {
        res(){
            if (this.password == '') {
                alert('密码不能为空')
            }else{
                this.axios.post('http://127.0.0.1:8000/rbac/v1/res/',{username:this.username,password:this.password}).then(res=>{
                if (res.data.code ==200) {
                    alert('注册成功')
                    this.$router.push('/login')
                }
                
            }).catch(err=>{
                console.log(err);
                alert('注册失败')
            })
            }
            
        },
        golog(){
            this.$router.push('/login')
        }
    },

    computed: {},

    watch: {},

    directives: {},

    filters: {}
};
</script>

<style scoped >
.div1{
    background-color: rgb(156, 228, 156);
    height: 1000px;
}
#building{
  background:url("../assets/veer-300207069.jpg");
  width:100%;
  height:100%;
  position:fixed;
  background-size:100% 100%;
  
}
#Register {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 0px;
}
body{
  margin:0;
  padding:0;
  border:0
}
</style>
